<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>安全问题</title>

		<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="../css/personal.css" rel="stylesheet" type="text/css">
		<link href="../css/stepstyle.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../js/vue2.5.js" ></script>
		<script type="text/javascript" src="../js/axios.min.js" ></script>
		<script type="text/javascript" src="../js/jquery.js" ></script>
		<script type="text/javascript" src="../js/global.js" ></script>
		<script type="text/javascript" src="../js/bootstrap/js/bootstrap.js" ></script>
		<script type="text/javascript" src="../js/layer/layer.js" ></script>
		<script src="../js/param.js"></script>
		<script src="../AmazeUI-2.4.2/assets/js/jquery.min.js" type="text/javascript"></script>
		<script src="../AmazeUI-2.4.2/assets/js/amazeui.js" type="text/javascript"></script>

	</head>

	<body>
		<div class="container">
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
							<li class="index"><a href="../index.html">首页</a></li>
							<li class="qc"><a href="text.html">推荐</a></li>
							<li class="qc"><a href="../home/search.html">搜索</a></li>
							<li class="qc"><a href="#">团购</a></li>
							<li class="qc last"><a href="about.html">我们</a></li>
						</ul>
						</div>
			</div>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="am-cf am-padding">
						<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">设置安全问题</strong> / <small>Set&nbsp;Safety&nbsp;Question</small></div>
					</div>
					<hr/>
					<!--进度条-->
					<div class="m-progress">
						<div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">设置安全问题</p>
                            </span>
							<span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
							<span class="u-progress-placeholder"></span>
						</div>
						<div class="u-progress-bar total-steps-2">
							<div class="u-progress-bar-inner"></div>
						</div>
					</div>
					<form class="am-form am-form-horizontal">
						<div v-for="(safety,index) in safetyData">
							
							<div class="am-form-group select">
								<label for="user-question1" class="am-form-label">问题一</label>
								<div class="am-form-content">
									<select data-am-selected>
										<option value="a" >请选择安全问题</option>
										<option value="b" selected>{{safety.squestion1}}</option>
										
									</select>
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-answer1" class="am-form-label">答案</label>
								<div class="am-form-content">
									<input type="text" id="user-answer1" :value="safety.sanswer1" placeholder="请输入安全问题答案">
								</div>
							</div>
						
							<div class="am-form-group select">
								<label for="user-question2" class="am-form-label">问题二</label>
								<div class="am-form-content">
									<select data-am-selected>
										<option value="a" >请选择安全问题</option>
										<option value="b"selected>{{safety.squestion2}}</option>
										
									</select>
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-answer2" class="am-form-label">答案</label>
								<div class="am-form-content">
									<input type="text" id="user-answer2" :value="safety.sanswer2" placeholder="请输入安全问题答案">
								</div>
							</div>
							<div class="info-btn">
								<input type="button" value="保存修改" class="am-btn am-btn-danger"  @click="update(safety.sid)"/>
								<input type="button" value="返回" class="am-btn am-btn-danger " onclick="history.back();"  />
							</div> 
						</div>
						

					</form>

				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 XXXX <a href="http://www.cssmoban.com/" target="_blank" title="模板之家"></a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></em>
						</p>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person active">
						<a href="person/index.html"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<!--管理员界面-->
					<li class="person">
						<p><i class="am-icon-qq"></i>管理系统</p>
						<ul>
							<li> <a href="querygoods.html">商品管理</a></li>
							<li> <a href="queryorder.html">订单管理</a></li>		
							
						</ul>
					</li>
					<!--普通界面-->
					<li class="person">
						<p><i class="am-icon-newspaper-o"></i>个人资料</p>
						<ul>
							<li> <a href="information.html">个人信息</a></li>
							<li> <a href="safety.html">安全设置</a></li>
							<li> <a href="address.html">地址管理</a></li>
							
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-balance-scale"></i>我的交易</p>
						<ul>
							<li><a href="order.html">订单管理</a></li>
							<li> <a href="change.html">退款售后</a></li>
							<li> <a href="comment.html">评价商品</a></li>
						</ul>
					</li>
					
					<li class="person">
						<p><i class="am-icon-tags"></i>我的收藏</p>
						<ul>
							<li> <a href="collection.html">收藏</a></li>
																
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-qrcode"></i>在线客服</p>
						<ul>
							<li> <a href="suggest.html">意见反馈</a></li>		
							<li> <a href="news.html">我的消息</a></li>
						</ul>
					</li>
					
				</ul>

			</aside>
		</div>
		</div>
		<script type="text/javascript">
		var uid = localStorage.getItem('id');
		var vue = new Vue({
			el:'.container',
			data:{
				safetyData:[]
				
			},
			methods:{
				
				get:function(){
					axios.get(baseUrl + '/safety/query',{
						params:{
							uid:uid
						}
					})
						.then(function(response) {
							
							this.safetyData = response.data;
							
						}.bind(this))
						.catch(function(error) {
							layer.msg('请求失败');
						});
				},
				update:function(sid){
					axios.get(baseUrl + '/safety/update',{
							params:{
								sid:sid,
								sanswer1:$("#user-answer1").val(),
								sanswer2:$('#user-answer2').val(),
								uid:uid
							}
						})
						.then(function(response) {
							layer.msg('保存中....', {icon: 16,time:500});
						}.bind(this))
						.catch(function(error) {
							layer.msg('请求失败');
						});
				}
				
				
			},
			mounted:function(){
				this.get();
			}	
		});	
		
	
		
	 	
	
		
		
		
		</script>
	</body>

</html>